import SoundManager = laya.media.SoundManager

class SoundPlayer {
    public static readonly Instance: SoundPlayer = new SoundPlayer()

    public mute: boolean

    constructor() {
        this.mute = false
    }

    setMute(mute: boolean): void {
        this.mute = mute;

        if (mute) {
            SoundManager.stopAll()
        } else {
            SoundManager.playMusic("images/sounds/main_music.ogg", 0, null)
        }
    }

    playMusicDie(): void {
        SoundManager.playSound("images/sounds/dead" + GetRandomNum(1, 4).toString() + ".ogg")
    }
}